﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Data.Sql;
using System.Web.Configuration;

public partial class _Default : System.Web.UI.Page
{
    //SqlConnection conn = new SqlConnection();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            FillPage();
        }

    }
    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {

    }
    private void FillPage()
    {
        string Rname = null;
        string Rdes = null;
        string Rphone = null;
        string Radr =null;
        string connectionString = WebConfigurationManager.ConnectionStrings["ConnectionStrBoss"].ConnectionString;
        using (SqlConnection conn = new SqlConnection(connectionString))
        {
            //先通过Aaccount找到所有订单号Dno日期作为约束条件
            //再根据Dno，找到所有信息。
            try
            {
                conn.Open();
                String sqlString = "select * from Boss_Rest";
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = sqlString;
                    SqlDataReader dr = cmd.ExecuteReader();
                    if (dr != null)
                    {
                        dr.Read();
                        Rname = dr["Rname"].ToString();
                        Rdes = dr["Rbrief"].ToString();
                        Rphone = dr["Rphone"].ToString();
                        Radr = dr["Radr"].ToString();
                    }
                    dr.Close();
                }
                RnameLab.Text = Rname;
                DesLab.Text = Rdes;
                TelTex.Text = Rphone;
                AdrTex.Text = Radr;
            }
            catch (Exception ez)
            {
                Response.Write(@"<b>异常信息:</b>" + ez.Message);
            }
            finally
            {
                conn.Close();
            }
        }
    }
    
}